cf46fff9bc89d42d5f23b2da1c2d807e1bcb3b89,opennms-services/src/main/java/org/opennms/netmgt/eventd/Persist.java,Persist,getServiceID,#String#,281

Before Change


        //
        // Check the name to make sure that it is not null
        //
        if (name == null)
            throw new NullPointerException("The service name was null");

        // ask persistd
        //
        int id = Eventd.getServiceID(name);
        if (id != -1)
            return id;

        //
        // talk to the database and get the identifer
        //
        m_getSvcIdStmt.setString(1, name);
        ResultSet rset = null;
        try {
            rset = m_getSvcIdStmt.executeQuery();
            if (rset.next()) {
                id = rset.getInt(1);
            }

        } catch (SQLException e) {
            throw e;
        } finally {
            rset.close();
        }

        // inform persistd about the new find
        //
        if (id != -1)
            Eventd.addServiceMapping(name, id);

        //
        // return the id to the caller

After Change


     * @see EventdConstants#SQL_DB_SVCNAME_TO_SVCID
     * 
     */
    private int getServiceID(String name) throws SQLException {
        Assert.notNull(name, "The service name must not be null");

        // ask persistd
        int id = Eventd.getServiceID(name);
        if (id != -1) {
            return id;
        }

        // talk to the database and get the identifer
        m_getSvcIdStmt.setString(1, name);
        ResultSet rset = null;
        try {
            rset = m_getSvcIdStmt.executeQuery();
            if (rset.next()) {
                id = rset.getInt(1);
            }
        } catch (SQLException e) {
            throw e;
        } finally {
            rset.close();
        }

        // inform persistd about the new find
        if (id != -1) {
            Eventd.addServiceMapping(name, id);
        }

        return id;